#include<iostream>
#include<iomanip>
using namespace std;
const int N = 1e2;
int arr[N][N];
int main()
{
	int n;
	cin >> n;
	int up = 0, down = n - 1, left = 0, right = n - 1;
	int k = 1;
	while (k <= n * n) {
		for (int i = left; i <= right; i++) {
			arr[up][i] = k++;
		 }
		for (int i = up + 1; i <= down; i++) {
			arr[i][right] = k++;
		}
		for (int i = right - 1; i >= left; i--) {
			arr[down][i] = k++;
		}
		for (int i = down - 1; i >= up+1; i--) {
			arr[i][left] = k++;
		}
		up++;
		down--;
		left++;
		right--;
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cout << setw(3) << arr[i][j];
		}
		cout << endl;
	}
	return 0;
}